package com.ztx.web.controller.param;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ztx.model.QkType;
import com.ztx.pagemodel.easyui.DataGrid;
import com.ztx.pagemodel.easyui.Json;
import com.ztx.pagemodel.easyui.PageHelper;
import com.ztx.service.base.IBaseService;
import com.ztx.service.param.IRateService;

/**
 * 
 * 欠款费率controller
 *
 */
@Controller
@RequestMapping("rateController")
public class FeeRateController {

	@Resource
	IBaseService baseService = null;

	@Resource
	IRateService rateService = null;

	/**
	 * 跳转到列表页面
	 * 
	 * @return
	 */
	@RequestMapping(value = "list", method = RequestMethod.GET)
	public String list() {
		return "param/rate";
	}

	/**
	 * 费率列表
	 * 
	 * @param qt
	 * @param ph
	 * @return
	 */
	@RequestMapping(value = "datagrid", method = RequestMethod.POST)
	@ResponseBody
	public DataGrid<QkType> datagrid(QkType qt, PageHelper ph) {
		DataGrid<QkType> dg = null;
		dg = rateService.datagrid(qt, ph);
		return dg;
	}

	@RequestMapping(value = "update", method = RequestMethod.POST)
	@ResponseBody
	public Json update(QkType qt) {
		Json j = new Json();
		try {
			baseService.update(QkType.class.getName() + ".updateQkType", qt);
		} catch (Exception e) {
			e.printStackTrace();
			j.setSuccess(false);
			j.setMsg(e.getMessage());
		}
		return j;
	}

}
